package cn.zhenxin.autocode.annotation.data;

import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import java.util.Map;
import java.util.Set;

/**
 *  监听ContextRefresedEvent 事件
 * @author jksk8
 *
 */
public class FillDataLoad implements ApplicationListener<ContextRefreshedEvent> {

    @Override
    public void onApplicationEvent(ContextRefreshedEvent event) {
        Map<String, Object> info =  event.getApplicationContext().getBeansWithAnnotation(Component.class);
        System.out.println("--------------------------------------------------------------------------------\n");
        for ( Map.Entry<String, Object> data : info.entrySet()){
            System.out.println(data.getKey());
        }
        System.out.println("--------------------------------------------------------------------------------\n");
    }
}
